package holoHistMsg

import (
	"context"

	"gitee.com/linxing_3/sr-core/config/source"
	"gitee.com/linxing_3/sr-core/domain"
	"gitee.com/mkwchecking/sr-admin/apps/holoHistMsg/adapter/http"
	"gitee.com/mkwchecking/sr-admin/apps/holoHistMsg/conf"
)

var _ domain.IDomain = (*HoloHistMsgDomain)(nil)

func NewHoloHistMsgDomain() domain.IDomain {
	return &HoloHistMsgDomain{}
}

type HoloHistMsgDomain struct {
}

// Install implements domain.IDomain.
func (a *HoloHistMsgDomain) Install(ctx context.Context, src source.ISource) error {
	var err error

	if err = http.InitHttp(ctx); err != nil {
		return err
	}

	return err
}

// OnSourceChange implements domain.IDomain.
func (a *HoloHistMsgDomain) BeforeStart(src source.ISource) error {
	conf.SetupConfig(src)

	return nil
}

// Start implements domain.IDomain.
func (a *HoloHistMsgDomain) Start(ctx context.Context) error {
	/* return http.OnStart(ctx) */
	return nil
}

// Stop implements domain.IDomain.
func (a *HoloHistMsgDomain) Stop(ctx context.Context) error {
	return nil
}
